<template>
    <div>
        <p><span>账号：</span><input type="text" v-model="form.username" placeholder="请输入账号"></p>
        <p><span>密码：</span><input type="password" v-model="form.password" placeholder="请输入密码"></p>
        <button @click="submit">登录</button>
    </div>
</template>

<script>
import axios from "axios"
export default {
    data(){
        return{
            form:{
                username:'',
                password:''
            }
        }
    },
    methods:{
        async http(){
            const res=await axios.post("/api/login",this.form)
            console.log(res)
            if(res.data.code===200){
                alert(res.data.mes)
            }else{
                alert(res.data.mes)
            }
        },
        submit(){
            this.http()
        }
    }
}
</script>

<style>

</style>